package com.li.service;

import com.li.mapper.ProjectMapper;
import com.li.pojo.Project;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

@Service
public class ProjectService {

    @Autowired
    ProjectMapper projectMapper;

    public Project queryProject(Project project){ return projectMapper.queryProjectByTitle(project);}

    public boolean addProject(Project project){
        if(projectMapper.queryProjectByTitle(project)==null)
        {
            projectMapper.insertProject(project);
            return  true;
        }
        return false;
    }

    public boolean deleteProject(Project project){
        if(projectMapper.queryProjectByTitle(project)!=null){
            projectMapper.deleteProject(project);
            return true;
        }
        return false;
    }

    public boolean updateProject(Project project){
        projectMapper.updateProject(project);
        return true;
    }

    public List<Project> allProject(){
        return projectMapper.listProject();
    }


}
